<?php
abstract   class lib_db_table extends lib_db_sql   {
	
	//protected   $table='`#__product`';
	
	public  function lists($page=true){	
		$this->page=$page;
		$sql=$this->selectWhere();
		return $this->db->fetchAll($sql);
	}
	
	public function id($id){
		$sql=$this->select_id($id);
		return $this->db->fetch($sql);
	}
	
	public function add(array $item=array()){
		$sql=$this->exarraysql($item,'insert');
		return $this->db->query($sql,1);
	}
	
	public function edit(array $item=array()){
		$sql=$this->exarraysql($item,'update');
		return $this->db->query($sql);
	}
	
	public function Where($item=array(),$page=true){
		$this->page=$page;
		$sql=$this->selectWhere($item);
		return $this->db->fetchAll($sql);
	}
	
	public function selectColm($where=array(),$col=array(),$limit=1,$page=true){
		$sql=parent::selectColm($where,$col,$page);
		if($limit=='1'){
			return $this->db->fetch($sql);	
		}else{
			return $this->db->fetchAll($sql);
		}
	}
	
	public function del($id){
		$sql=$this->delete_id($id);
		return $this->db->query($sql);
	}
	
	public  function total($item=array()){
		$sql=$this->totalRow($item);
		$result=$this->db->fetch($sql);
		return $result['total'];
	}
}